package cz.af.portletExams.backend.rest;

import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.SimpleClientHttpRequestFactory;

import java.io.IOException;
import java.net.URI;

public class ExamsClientHttpRequestFactory extends SimpleClientHttpRequestFactory {

    @Override
    public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
        final ClientHttpRequest request = super.createRequest(uri, httpMethod);
        request.getHeaders().add("Authorization", "Basic " + ExamsOverViewBackendRestConstants.KOSAPI_PASSWORD);
        return request;
    }
}
